import request from '@/utils/request'

// 查询工艺路线列表
export function listProroute(query) {
  return request({
    url: '/mes/pro/proroute/list',
    method: 'get',
    params: query
  })
}

// 查询工艺路线详细
export function getProroute(routeId) {
  return request({
    url: '/mes/pro/proroute/' + routeId,
    method: 'get'
  })
}

// 新增工艺路线
export function addProroute(data) {
  return request({
    url: '/mes/pro/proroute',
    method: 'post',
    data: data
  })
}

// 修改工艺路线
export function updateProroute(data) {
  return request({
    url: '/mes/pro/proroute',
    method: 'put',
    data: data
  })
}

// 删除工艺路线
export function delProroute(routeId) {
  return request({
    url: '/mes/pro/proroute/' + routeId,
    method: 'delete'
  })
}

// 根据产品编号查询工艺
export function getRouteByItem(itemId) {
  return request({
    url: '/mes/pro/proroute/getRouteByItem/' + itemId,
    method: 'get'
  })
}

// 状态修改
export function changeStatus(routeId, enableFlag) {
  const data = {
    routeId,
    enableFlag
  }
  return request({
    url: '/mes/pro/proroute/status',
    method: 'put',
    data: data
  })
}

// 状态修改
export function changeEnable(routeId, enableStatus) {
  const data = {
    routeId,
    enableStatus
  }
  return request({
    url: '/mes/pro/proroute/enableStatus',
    method: 'put',
    data: data
  })
}


// 查询工艺路线列表
export function listProrouteBom(query) {
  return request({
    url: '/mes/pro/proroute/bom/list',
    method: 'get',
    params: query
  })
}

// 查询工艺路线详细
export function getProrouteBom(routeId) {
  return request({
    url: '/mes/pro/proroute/bom/' + routeId,
    method: 'get'
  })
}

// 新增工艺路线
export function addProrouteBom(data) {
  return request({
    url: '/mes/pro/proroute/bom',
    method: 'post',
    data: data
  })
}

// 修改工艺路线
export function updateProrouteBom(data) {
  return request({
    url: '/mes/pro/proroute/bom',
    method: 'put',
    data: data
  })
}

// 删除工艺路线
export function delProrouteBom(routeId) {
  return request({
    url: '/mes/pro/proroute/bom/' + routeId,
    method: 'delete'
  })
}


// 根据bomID确认
export function confirmRouteStatus(routeId) {
  return request({
    url: '/mes/pro/proroute/bom/status/' + routeId,
    method: 'put',
  })
}


// 状态修改
export function changeRouteStatus(routeId, enableFlag) {
  const data = {
    routeId,
    enableFlag
  }
  return request({
    url: '/mes/pro/proroute/bom/status',
    method: 'put',
    data: data
  })
}

// 状态修改
export function changeEnableStatus(routeId, enableStatus) {
  const data = {
    routeId,
    enableStatus
  }
  return request({
    url: '/mes/pro/proroute/bom/enableStatus',
    method: 'put',
    data: data
  })
}

// 复制工艺路线
export function copyProroute(routeId) {
  return request({
    url: '/mes/pro/proroute/copy/' + routeId,
    method: 'post'
  })
}


// 复制工艺路线
export function copyProrouteBom(routeId) {
  return request({
    url: '/mes/pro/proroute/bom/copy/' + routeId,
    method: 'post'
  })
}
